package com.hw.paltfrom.controller.weight;

import com.hw.paltfrom.pack.ResponseResult;
import com.hw.paltfrom.rescode.HWSystemCode;
import com.hw.paltfrom.service.weight.DataOffSiteHistoryServer;
import com.hw.paltfrom.utils.VerifyUtil;
import com.hw.paltfrom.vo.DataOffsiteVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;
/**
 * 非现场检测数据管理
 * 梁天
 * 2019/11/06
 *
 **/
@RestController
@RequestMapping(value = "/DataOffSiteController")
public class DataOffSiteHistoryController {

    @Autowired
    private DataOffSiteHistoryServer dataOffSiteHistoryServer;

    /**
     * 分页+模糊查询
     *
     * @param vo
     * @return
     */
    @RequestMapping(value = "/queryAllList")
    public Map<String, Object> queryAllList(@RequestParam HashMap<String,Object> vo) {
        Boolean flag = VerifyUtil.verifyParams(vo);
        if (!flag) {
            return ResponseResult.fail(HWSystemCode.PARAMS_ERROR);
        }
        return dataOffSiteHistoryServer.queryAllList(vo);
    }

    /**
     * 添加
     *
     * @param vo
     * @return
     */
    @RequestMapping(value = "/add")
    public Map<String, Object> userAdd(DataOffsiteVO vo) {
        Boolean flag = VerifyUtil.verifyParams(vo);
        if (!flag) {
            return ResponseResult.fail(HWSystemCode.PARAMS_ERROR);
        }
        return dataOffSiteHistoryServer.insert(vo);
    }



}
